var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function a() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((a.prototype = n.prototype), new a()));
      };
    })(),
  AXEducationalView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.loadeducateSkillData = {
          caller: t,
          code: 1391,
          method: function (e) {
            0 == e.code
              ? ToastView.toastView("您已成功学习")
              : ToastView.toastView(e.msg);
          },
        }),
        (t.loadShengJiSkillData = {
          caller: t,
          code: 1392,
          method: function (e) {
            0 == e.code
              ? ToastView.toastView("您已成功升级")
              : ToastView.toastView(e.msg);
          },
        }),
        (t.loadHeroSkillData = {
          caller: t,
          code: 1382,
          method: function (e) {
            if (0 == e.code) {
              var n = [];
              t.listData = e.data;
              for (var a, i = 0; i < t.listData.length; i++)
                (a = {
                  skill_name: { text: t.listData[i].name },
                  skill_descr: {
                    text: t.dealSkillDescrName(
                      t.listData[i].grade,
                      t.listData[i].useCount
                    ),
                  },
                  educate_btn: { label: t.dealButtonName(t.listData[i].grade) },
                }),
                  n.push(a);
              (t.list_educate.array = n),
                (t.list_educate.selectEnable = !0),
                t.list_educate.on(Laya.Event.CLICK, t, t.onEductationDidClick);
            }
          },
        }),
        t.btn_educateCancle.on(Laya.Event.CLICK, t, t.onCanCleDidClick),
        WebSocketService.addListener(t.loadHeroSkillData),
        WebSocketService.addListener(t.loadeducateSkillData),
        WebSocketService.addListener(t.loadShengJiSkillData),
        t.btn_jinengchongxiu.on(Laya.Event.CLICK, t, t.onFuJiangJiNengChongXiu),
        t.btn_jinengshengji.on(Laya.Event.CLICK, t, t.onFuJiangJiNengShengJiFn),
        t.btn_jinengxuexi.on(Laya.Event.CLICK, t, t.onFuJiangJiNengShengJiFn),
        t
      );
    }
    return (
      __extends(t, e),
      (t.openView = function () {
        return (
          null == this.educationVC && (this.educationVC = new t()),
          WebSocketService.send({ c: 1382, d: null }),
          this.educationVC
        );
      }),
      (t.prototype.onEductationDidClick = function (e) {
        if ("educate_btn" == e.target.name) {
          var t = this.listData[this.list_educate.selectedIndex].id;
          "学习" == e.target.label
            ? WebSocketService.send({ c: 1391, d: { id: t } })
            : "升级" == e.target.label &&
              WebSocketService.send({ c: 1392, d: { id: t } });
        }
      }),
      (t.prototype.dealButtonName = function (e) {
        return 0 == parseInt(e) ? "学习" : "升级";
      }),
      (t.prototype.dealSkillDescrName = function (e, t) {
        return 0 == parseInt(e) ? "" : "(" + e + "级" + t + "熟练度)";
      }),
      (t.prototype.onFuJiangJiNengShengJiFn = function (e) {
        if ("item0" == e.target.name) {
          (t = AXLegatusView.showLegatusView("2")).pos(0, 35),
            Laya.stage.addChild(t);
        } else {
          var t = AXLegatusView.showLegatusView("1");
          t.pos(0, 35), Laya.stage.addChild(t);
        }
      }),
      (t.prototype.onFuJiangJiNengChongXiu = function () {
        var e = AXLegatusView.showLegatusView("3");
        e.pos(0, 35), Laya.stage.addChild(e);
      }),
      (t.prototype.onCanCleDidClick = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.SubSquareController.AXEducationalViewUI);
